Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename ImplItem_::*ImplItem to ImplItem_::* #29766

Merged
merged 3 commits into from
Nov 17, 2015
Merged

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Nov 11, 2015

[breaking change]

I'm not sure if those renames are ok. TokenType::Tt* to TokenType::* was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

cc @rust-lang/compiler, thoughts about naming here?

@eddyb
Copy link
Member

eddyb commented Nov 11, 2015

I was pondering doing a different kind of rename, Item -> ItemNode and Item_ -> Item, to allow using, e.g. Item::Trait instead of ItemTrait (same for other AST nodes, not just Item).
But the "node" type is still used a lot so it's not a great solution.

@nrc
Copy link
Member

nrc commented Nov 11, 2015

I approve - I think we should make more use of namespaced enums like this. I also agree with eddyb that it would be nice not to have _ in enum names (the proper solution, I think, is more sophisticated concrete data types, part of the efficient inheritance work).

@eddyb
Copy link
Member

eddyb commented Nov 11, 2015

The common enum fields part of ADT hierarchies would indeed solve this long-standing problem quite elegantly, but I'm not sure what the timeline for those is.

@nikomatsakis
Copy link
Contributor

I've been wanting to do something like this, but I am not a big fan of the _ names, I would want to adjust that naming scheme first.

@alexcrichton
Copy link
Member

r? @eddyb (moving to random compilers team member)

@rust-highfive rust-highfive assigned eddyb and unassigned alexcrichton Nov 12, 2015
@nikomatsakis
Copy link
Contributor

So, I'm going to take a stand and say that I do not want to type ast::Item_::Foo. I think the usual convention in this situation is to rename Item_ to ItemKind (and probably rename the node field to kind), which is sort of the opposite of what @eddyb suggested. It has the downside that one must write ast::ItemKind::Foo, which is long, but the upside that the "main type" is ast::Item and that you access item.kind to get a value of type ItemKind (whereas in @eddyb's proposal you access item.node to get a value of type Item). I could go either way on which renaming we do, but I think if we're going to change to use namespace'd variants for Item and friends, we should rename at the same time.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 13, 2015

addressed the comments and also did the renaming for ast::ImplItem_::*

@bors
Copy link
Contributor

bors commented Nov 15, 2015

☔ The latest upstream changes (presumably #29387) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 16, 2015

rebased

@nikomatsakis
Copy link
Contributor

@bors r+

ok, since conversation is sort of dead, let's just do this thing. We can always adjust the naming scheme later. Thanks @oli-obk. (Merge conflicts here we come!)

@bors
Copy link
Contributor

bors commented Nov 17, 2015

📌 Commit d09220d has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Nov 17, 2015

⌛ Testing commit d09220d with merge b31cc64...

bors added a commit that referenced this pull request Nov 17, 2015
[breaking change]

I'm not sure if those renames are ok. [TokenType::Tt* to TokenType::*](#29582) was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants